package core;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * 
 * @author Meng Yuan 
 * represent one itinerary, in other word, one trip solution
 * for move from start to end
 */
public class Itinerary {
	private String itineraryName;
	private List<Route> routes;
	private List<String> transfers;
	private String tripTime;

	public Itinerary() {
		super();
		this.routes = new ArrayList<Route>();
		this.transfers = new ArrayList<String>();
	}

	public String getItineraryName() {
		return itineraryName;
	}

	public void setItineraryName(String itineraryName) {
		this.itineraryName = itineraryName;
	}

	public String getTripTime() {
		return tripTime;
	}

	public void setTripTime(String tripTime) {
		this.tripTime = tripTime;
	}

	public List<Route> getRoutes() {
		return routes;
	}

	public List<String> getTransfers() {
		return transfers;
	}

	public void addRoute(Route route) {
		this.routes.add(route);
	}

	public void addTransfer(String transfer) {
		this.transfers.add(transfer);
	}
	
	public void print(){
		System.out.println(this.itineraryName);
		Iterator<Route> routeIter=this.routes.iterator();
		Iterator<String> transferIter=this.transfers.iterator();
		if(routeIter.hasNext()){
			routeIter.next().print();
		}
		while(transferIter.hasNext()){
			System.out.println(transferIter.next());
			routeIter.next().print();
		}
		System.out.println(this.tripTime);
	}

}
